<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>两面翻转的盒子案例</title>
    <style>
        body{
            /*透视perspective：值px；  */
            perspective: 400px;
        }
        .box{
            position: relative;
            width: 300px;
            height: 300px;
            margin: 100px auto;
            transition: all .4s;
            /* 让背面的紫色盒子保留立体空间，给父级添加。很重要！！！ */
            transform-style:preserve-3d ;
        }
        .box:hover{
            transform: rotateY(180deg);
        }
        .front,
        .back{
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            font-size: 30px;
            text-align: center;
            line-height: 300px;
            color: #fff;
        }
        .front{
            background-color: pink;
            /* 层叠性为1在最上面 */
            z-index: 1;
            /* 背面才能显示出来 */
            backface-visibility: hidden;
        }
        .back{
            background-color: lightblue;
            /* 背靠背旋转 */
            transform: rotateY(180deg);
        }

    </style>
</head>
<body>
    <div class="box">
        <div class="front">白云</div>
        <div class="back">黑土</div>
    </div>
</body>
</html>